﻿using System.Collections.Generic;
using Castle.ActiveRecord;
using Castle.ActiveRecord.Linq;

namespace ClientOverflow.DataObjects
{
    /// <summary>
    /// User class represents the users table in the database. The class maintain the relationship
    /// with questions table and answers table.
    /// </summary>
    [ActiveRecord]
    public class User : ActiveRecordLinqBase<User>
    {
        [PrimaryKey]
        public int ID { get; set; }

        [Property]
        public string Name { get; set; }

        [Property(Unique = true)]
        public string Email { get; set; }

        [Property]
        public string Password { get; set; }

        [HasMany]
        public IList<Question> Questions { get; set; }
        
        [HasMany]
        public IList<Answer> Answers { get; set; }

        [BelongsTo]
        public Department Department { get; set; }
    }
}
